
var ParseTemplate = ZFT.Util.ParseTemplate;
var STip = ZFT.Util.STip;

var Template = {
    // detail: ParseTemplate(require("./tpl/detail.xtpl"))
}
var DateBox = ZFT.Util.Class({
    container: $("#datetimeBox"),
    init: function () {
        var _this = this;
        _this.initDate();
    },
    initDate: function () {
        var _this = this;
        var container = _this.container;
        ZFT.Util.Ajax("/r/UserCenter_getNoticeDay", {
            type: "POST",
            dataType: "json",
            success: function (res) {
                if (res.code == 200) {

                    $("#datetimeBox").datepicker({
                        language: "zh-CN",
                        //startDate:new Date(),
                        todayHighlight: true,
                        beforeShowDay: function (date) {
                            if (res.data.length > 0) {
                                if (date.getFullYear() == (new Date()).getFullYear()) {
                                    if (date.getMonth() == (new Date()).getMonth()) {
                                        for (var i = 0, len = res.data.length; i < len; i++) {
                                            if (res.data[i] == date.getDate()) {
                                                return {
                                                    tooltip: "交款日",
                                                    classes: "payday disabled",
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    });
                } else {
                    return STip("fail", res.msg);
                }
            }
        })


    }
})

$(function () {
    new DateBox();
})